﻿/* Description: jQuery Legend plugin
//* Created On: 05-Sep-2011
//* Created By: Senthilnathan 
//* Last Modified On: 
//* Last Modified By:
//* Last Modified Reason:
Example Usage:
$("#phLegend").legend({ gray: "#6e6e6e", orange: "#f78d1d"});
Where
    1) #phLegend -> Any dom element. Legend will be attached next to this element in the Dom tree
    2) config -> Javascript object as key, value pairs i.e. { gray: "#6e6e6e", orange: "#f78d1d"}
    
    Note: Call this in the page load complete event.
    Complete example with Jquery on Dom ready (page load complete)
     $(function() {$("#phLegend").legend({ gray: "#6e6e6e", orange: "#f78d1d"});});
*/
(function($) {
$.fn.legend = function(config) {    
        //config = $.extend({}, $.fn.legend.defaults, config);
        this.each(function() {
            var spnLegends = "";
            jQuery.each(config, function(key, value) {                   
                    spnLegends += "<span style='font: 10pt;font-family: Arial;padding: 0px 4px;border-left: 6px solid " + value + ";'>" + key + "</span>";
                });
                $(this).after(spnLegends).next();
        });
    }
    
    $.fn.legend.defaults = { gray: "#6e6e6e", orange: "#f78d1d", blue: "#0095cd", rosy: "#da5867", green: "#64991e", pink: "#f895c2", red : "#d81b21" };

})(jQuery);